.class public Lorg/microemu/app/classloader/ClassPreprocessor;
.super Ljava/lang/Object;
.source "ClassPreprocessor.java"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 41
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static instrument(Ljava/io/InputStream;Lorg/microemu/app/classloader/InstrumentationConfig;)[B
    .locals 5
    .parameter "classInputStream"
    .parameter "config"

    .prologue
    .line 45
    :try_start_0
    new-instance v0, Lorg/objectweb/asm/ClassReader;

    invoke-direct {v0, p0}, Lorg/objectweb/asm/ClassReader;-><init>(Ljava/io/InputStream;)V

    .line 46
    .local v0, cr:Lorg/objectweb/asm/ClassReader;
    new-instance v2, Lorg/objectweb/asm/ClassWriter;

    const/4 v4, 0x0

    invoke-direct {v2, v4}, Lorg/objectweb/asm/ClassWriter;-><init>(I)V

    .line 47
    .local v2, cw:Lorg/objectweb/asm/ClassWriter;
    new-instance v1, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;

    invoke-direct {v1, v2, p1}, Lorg/microemu/app/classloader/ChangeCallsClassVisitor;-><init>(Lorg/objectweb/asm/ClassVisitor;Lorg/microemu/app/classloader/InstrumentationConfig;)V

    .line 48
    .local v1, cv:Lorg/objectweb/asm/ClassVisitor;
    const/4 v4, 0x0

    invoke-virtual {v0, v1, v4}, Lorg/objectweb/asm/ClassReader;->accept(Lorg/objectweb/asm/ClassVisitor;I)V

    .line 49
    invoke-virtual {v2}, Lorg/objectweb/asm/ClassWriter;->toByteArray()[B
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v4

    .line 52
    .end local v0           #cr:Lorg/objectweb/asm/ClassReader;
    .end local v2           #cw:Lorg/objectweb/asm/ClassWriter;
    .end local v1           #cv:Lorg/objectweb/asm/ClassVisitor;
    :goto_0
    return-object v4

    .line 50
    :catch_0
    move-exception v4

    move-object v3, v4

    .line 51
    .local v3, e:Ljava/io/IOException;
    const-string v4, "Error loading MIDlet class"

    invoke-static {v4, v3}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 52
    const/4 v4, 0x0

    goto :goto_0
.end method
